import java.io.*;

public class multiples {
   public static void main (String[] args) throws IOException {
      if (args.length < 1 ) throw new RuntimeException ("not enough arguments");
      if ( args.length > 1 ) throw new RuntimeException ("too many arguments");
      BufferedReader reader = new BufferedReader (new FileReader (new File (args[0])));
      String line;
      while ( (line = reader.readLine()) != null) {
        //split the arguments in each line
        String[] multArgs = line.split(",");
        int smallest =  smallestMultiple (Integer.parseInt(multArgs[0]),Integer.parseInt(multArgs[1]));
        System.out.println(smallest);
      }
   }
 static int  smallestMultiple (int x, int n) {
     int i = 1;
     int tmp = n;
     while (true) {
        n = n * i;
        i++;
        if (n > x) break;
        n = tmp;
     }
     return n;
}
}